$(document).ready(function() {
		$("#menus-setting>a").click(function(){
			var boxx = new Helper.Window( {
				id:"Helper_Window_menus_setting",
				url:Helper.basePath + "/member_operate/findMenusSetting.htm",
				params:{backurl:"/page/memberinfo/user/menus-setting.jsp"},
				title:"设置常用菜单",
				width:530,
				height:350,
				onSuccess:function(){
					this.close();
				}
			});
			boxx.show();
		});
		$(":input[type='checkbox'][class='inputcheckbox']").live('click',function(){
			if($(":input[type='checkbox'][class='inputcheckbox'][checked]").length>5)
			{
				Helper.message("最多只能选5个您常用的菜单。");
				return;
			}
			if($(this).attr("checked"))
			{
				$(this).parent().attr("class","item checked");
			}
			else
			{
				$(this).parent().attr("class","item");
			}
		});

		$("#jdmenus-clear").live('click',function(){
			$(":input[type='checkbox'][class='inputcheckbox']").each(function(){
				if($(this).attr("checked"))
				{
					$(this).attr("checked","");
					$(this).parent().attr("class","item");
				}
			});
		});

		$("#sbt_menus_a").live('click',function(){
			var _ids = [];
			$(":input[type='checkbox'][class='inputcheckbox'][checked]").each(function(i){
				_ids[i] = $(this).val();
			});
			new Helper.RemoteTrans({url:Helper.basePath+"/member_operate/menusSetting.htm",params:{menus:_ids},onSuccess:function(data){
					if(data.isSuccess)
					{
						Helper.message("恭喜您,设置成功。");
						Helper.getComponent("Helper_Window_menus_setting").onSuccess();
						window.location.reload(true);
					}
					else
					{
						Helper.message("很遗憾,"+data.message+"。");
					}
			}}).send();

		});
		$("#cancel_menus_a").live('click',function(){
			Helper.getComponent("Helper_Window_menus_setting").onSuccess();
		});
	});
